using TimeDRODPOF.TDLib;
using VeeTileEngine2012;

namespace TimeDRODPOF.TDComponents
{
    public class TDCEgg : Component
    {
        private readonly bool _friendly;

        public TDCEgg(int mTurnsToHatch, bool mFriendly = false)
        {
            TurnsToHatch = mTurnsToHatch;
            _friendly = mFriendly;
        }
        public int TurnsToHatch { get; private set; }

        public override void NextTurn()
        {
            base.NextTurn();

            TurnsToHatch--;
            if (TurnsToHatch != 0) return;
            Entity.Destroy();
            TDLFactory.Tile = Field.GetTile(X, Y);
            if (_friendly) Field.AddEntity(TDLFactory.StalwartRoach());
            else Field.AddEntity(TDLFactory.Roach());
        }
    }
}